<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Leo extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->library('encrypt');
    }

    /* admin area */

    function login($data) {
        $this->db->where('username', $data['username']);
        $this->db->where('password', $this->encrypt->sha1($data['password']));
        $hsl = $this->db->get('user');
        if ($hsl->num_rows == 1) {
            return $hsl->result();
        }else{
            return FALSE;
        }
    }
    
    function reg_user($reg){
        $this->db->insert('user', $reg);
    }


    function get($isi){
        $username = $this->security->xss_clean($isi['username']);
        $password = $this->security->xss_clean($isi['password']);
        $this->db->where('username', $username);
        $this->db->where('password', $this->encrypt->sha1($password));
        $query = $this->db->get('user');
        if($query->num_rows == 1){
            return $query->result();
        }else{
            return FALSE;
        }
    }
}

/* End of file leo.php */
/* Location: ./application/model/leo.php */
